package com.gzedu.module.faced.curd.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gzedu.common.sys.config.Global;
import com.gzedu.common.util.page.Page;
import com.gzedu.module.faced.curd.CurdFormFacade;
import com.gzedu.module.modle.curd.CurdForm;
import com.gzedu.module.service.curd.ICurdFormService;

@Service
public class CurdFormFacadeImpl implements CurdFormFacade{
	@Autowired
	private ICurdFormService curdFormService;
	
	
	public Page getCurdFormInfo(CurdForm curdForm, int pageNo){
		return curdFormService.page(curdForm, pageNo, Global.pageSize);
	}


	public boolean insertCurdForm(CurdForm curdForm) {
		// TODO Auto-generated method stub
		return curdFormService.insert(curdForm) > 0;
	}


	public List<CurdForm> selectByFormId(CurdForm curdForm) {
		// TODO Auto-generated method stub
		return curdFormService.selectByFormId(curdForm);
	}


	public String getModulePath(String formId) {
		// TODO Auto-generated method stub
		String modulePath = null;
		CurdForm curdForm = new CurdForm();
		curdForm.setCurd_form_id(formId);
		List<CurdForm> result = curdFormService.selectByFormId(curdForm);
		if(result != null && result.size() > 0){
			for(CurdForm cf : result){
				modulePath = cf.getModule_path();
			}
		}
		return modulePath;
	}


	public List<CurdForm> selectByFormId(String curd_form_id) {
		// TODO Auto-generated method stub
		CurdForm curdForm = new CurdForm();
		curdForm.setCurd_form_id(curd_form_id);
		return curdFormService.selectByFormId(curdForm);
	}


	public CurdForm getById(String id) {
		// TODO Auto-generated method stub
		return curdFormService.getById(id);
	}


	public boolean updateFormInfo(CurdForm curdForm) {
		// TODO Auto-generated method stub
		return curdFormService.updateById(curdForm) > 0;
	}
}
